<html>
<head><meta charset="utf-8"><title>RFC2366 vs. Us · project-portable-simd · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/index.html">project-portable-simd</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/RFC2366.20vs.2E.20Us.html">RFC2366 vs. Us</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="238912415"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/RFC2366%20vs.%20Us/near/238912415" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/RFC2366.20vs.2E.20Us.html#238912415">(May 15 2021 at 17:17)</a>:</h4>
<p>Reviewing RFC2366, it becomes apparent to me that there's another reason to eschew explicit-wrapping APIs in favor of defining SIMD as wrapping by default: on top of the performance concerns, they are an ENORMOUS implementation overhead.</p>



<a name="238912521"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/RFC2366%20vs.%20Us/near/238912521" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/RFC2366.20vs.2E.20Us.html#238912521">(May 15 2021 at 17:19)</a>:</h4>
<p>What do you mean by explicit wrapping vs wrapping by default?</p>



<a name="238912613"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/RFC2366%20vs.%20Us/near/238912613" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/RFC2366.20vs.2E.20Us.html#238912613">(May 15 2021 at 17:20)</a>:</h4>
<p>I should say annotated wrapping: Wrapping&lt;T&gt; and <code>.wrapping_</code> methods</p>



<a name="238912684"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/RFC2366%20vs.%20Us/near/238912684" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/RFC2366.20vs.2E.20Us.html#238912684">(May 15 2021 at 17:21)</a>:</h4>
<p>Oh, gotcha, I thought you meant wrapper types, not wrapping arithmetic</p>



<a name="238912752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/RFC2366%20vs.%20Us/near/238912752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/RFC2366.20vs.2E.20Us.html#238912752">(May 15 2021 at 17:22)</a>:</h4>
<p>I am still vaguely interested in debug-mode checked arithmetic but yeah it would need a lot of compiler work</p>



<a name="238912777"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/RFC2366%20vs.%20Us/near/238912777" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/RFC2366.20vs.2E.20Us.html#238912777">(May 15 2021 at 17:23)</a>:</h4>
<p>Likewise, questions about unsafe vector load/stores consumed a lot of RFC2366's "brain budget".</p>



<a name="238912812"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/RFC2366%20vs.%20Us/near/238912812" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/RFC2366.20vs.2E.20Us.html#238912812">(May 15 2021 at 17:24)</a>:</h4>
<p>As well as anything that proposed making certain lanes undef (e.g. <code>div</code>).</p>



<a name="238912857"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/RFC2366%20vs.%20Us/near/238912857" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/RFC2366.20vs.2E.20Us.html#238912857">(May 15 2021 at 17:24)</a>:</h4>
<p>That's interesting, because I think generally you can use ptr::read</p>



<a name="238913273"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/RFC2366%20vs.%20Us/near/238913273" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/RFC2366.20vs.2E.20Us.html#238913273">(May 15 2021 at 17:31)</a>:</h4>
<p>A lot of it was alignment.</p>



<a name="238913410"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/RFC2366%20vs.%20Us/near/238913410" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/RFC2366.20vs.2E.20Us.html#238913410">(May 15 2021 at 17:33)</a>:</h4>
<p>Yeah, you'd need to use unaligned_read in most situations probably</p>



<a name="238913505"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/RFC2366%20vs.%20Us/near/238913505" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/RFC2366.20vs.2E.20Us.html#238913505">(May 15 2021 at 17:34)</a>:</h4>
<p>There may be a good way to make a safer but zero overhead API</p>



<a name="238922411"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/RFC2366%20vs.%20Us/near/238922411" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/RFC2366.20vs.2E.20Us.html#238922411">(May 15 2021 at 20:13)</a>:</h4>
<p>Splitting RFC2366 into its own thread, since I realized we were talking mostly about it and I wanted to continue talking about it.<br>
Here's the RFC: <a href="https://github.com/gnzlbg/rfcs/blob/7011673b2dc5b493cb8be937bf11dd8449f58135/text/0000-ppv.md">https://github.com/gnzlbg/rfcs/blob/7011673b2dc5b493cb8be937bf11dd8449f58135/text/0000-ppv.md</a><br>
And its peanut gallery: <a href="https://github.com/rust-lang/rfcs/pull/2366">https://github.com/rust-lang/rfcs/pull/2366</a></p>



<a name="238922523"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/RFC2366%20vs.%20Us/near/238922523" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/RFC2366.20vs.2E.20Us.html#238922523">(May 15 2021 at 20:15)</a>:</h4>
<p>One of the things we've notably done: our API is now internally arrays. This means we don't have to touch a tuple, except for our "1-tuple" of the inner array. This means we don't have to <em>specify the layout</em> of a tuple, either! Meanwhile, arrays of relatively simple types <em>do</em> have comparatively trivial layouts we can make statements about. I propose this is a desirable property.</p>



<a name="238922656"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/RFC2366%20vs.%20Us/near/238922656" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/RFC2366.20vs.2E.20Us.html#238922656">(May 15 2021 at 20:18)</a>:</h4>
<p>Yep. Really all repr(simd) is doing for us now is requiring an alignment (which we aren't even sure is right <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span>) and gating the intrinsics</p>



<a name="238928146"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/RFC2366%20vs.%20Us/near/238928146" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/RFC2366.20vs.2E.20Us.html#238928146">(May 15 2021 at 21:56)</a>:</h4>
<p>Yeah, I figure notionally that <code>repr_simd</code> is basically saying "yes, this can go in a SIMD register", basically. <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="241085902"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/RFC2366%20vs.%20Us/near/241085902" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/RFC2366.20vs.2E.20Us.html#241085902">(Jun 01 2021 at 22:55)</a>:</h4>
<p>From <a href="https://rust-lang.github.io/rfcs/2325-stable-simd.html#portable-packed-simd">https://rust-lang.github.io/rfcs/2325-stable-simd.html#portable-packed-simd</a>:</p>
<blockquote>
<p>Or, in other words, it's intended that portable SIMD types are entirely decoupled from intrinsics. If they both end up being implemented then there will be [zero]-cost interoperation between them, but neither will necessarily depend on the other.</p>
</blockquote>
<p>So that's interesting because zero cost interop with machine vectors is implicitly part of our mandate.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>